//
//  BulidingCardCell.m
//  QRMaster
//
//  Created by myApple on 16/5/10.
//  Copyright © 2016年 myApple. All rights reserved.
//

#import "BulidingCardCell.h"

@interface BulidingCardCell()
{
    UILabel * bulidingNameLabel;
    UIImageView * selectImageView;
}

@end

@implementation BulidingCardCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self prepareView];
    }
    return self;
}

-(void)prepareView
{
    float ScreenWidth = [UIScreen mainScreen].bounds.size.width;
    float x = 22;
    float y = 12;
    float width = ScreenWidth - x - 60;
    float height = 20;
    
    bulidingNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(x, y, width, height)];
    bulidingNameLabel.font = [UIFont systemFontOfSize:15.0];
    [self.contentView addSubview:bulidingNameLabel];
    
    
    x = UI_SCREEN_WIDTH - 38;
    y = (44 - 18)/2.0;
    width = 22;
    height = 18;
    selectImageView = [[UIImageView alloc]initWithFrame:CGRectMake(x, y, width, height)];
    selectImageView.image = [UIImage imageNamed:@"isSelect"];
    selectImageView.hidden = YES;
    [self.contentView addSubview:selectImageView];
}

-(void)setBulidingId:(NSString *)bulidingId
{
    _bulidingId = bulidingId;
}


-(void)setBulidingName:(NSString *)bulidingName
{
    _bulidingName = bulidingName;
    bulidingNameLabel.text = bulidingName;
}

-(void)setIsSelected:(BOOL)isSelected
{
    _isSelected = isSelected;
    if (isSelected) {
        bulidingNameLabel.textColor = UIColorFromRGB(0x7dc234);
        selectImageView.hidden = NO;
    }
    else
    {
        bulidingNameLabel.textColor = [UIColor blackColor];
        selectImageView.hidden = YES;
    }
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
